package com.marcocirillo.justweet;

import twitter4j.*;

public class JusTweet {

	/**
	 * @param args
	 */
	
	private String username;
	//private String password;
	private Twitter user;
	
	public JusTweet(String username, String password)
	{
		this.username = username;
		this.user = (Twitter) new TwitterFactory().getInstance(username, password);
	}
	
	public Status updateStatus(String status) throws TwitterException
	{
		Status returnStatus = this.user.updateStatus(status);
		return returnStatus;
		
	}
	
	public Status getCurrentStatus() throws TwitterException
	{
		return getCurrentUser().getStatus();
	}
	
	public User getCurrentUser() throws TwitterException
	{
		return this.user.showUser(this.username);
	}
	
	public String toString()
	{
		String s = null;
		
		try
		{
			s = this.user.getScreenName() +"'s Status is now: " + getCurrentStatus().getText();
		} catch (TwitterException e)
		{
			s = e.getMessage();
		}
		
		return s;
	}
	
	public String getStringURL() throws TwitterException
	{
		return getCurrentUser().getURL().toString();
	}

}
